#ifndef PATTERN_H
#define PATTERN_H
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <string>
#include "stringtokenizer.h"
#include "matcher.h"
#include "utilities.h"
#include "spa_types.h"
using namespace std;

/*****************************
Implementation of bmpSearch and computeBmpLast is taken from
http://dev-faqs.blogspot.com/2010/05/boyer-moore-algorithm.html
they are parts of Boyer Moore Algorithm, which garantees us O(n) complexity, which we are
going to use for pattern matching, compared to string.h implementation of string::find, which has worst case of O(mn)

******************************/

class Pattern
{
private:
	Matcher matcher;
	Utilities utilities;
public:
	static const int LEFT_UNDERSCORE = 0;
	static const int LEFT_VARIABLE = 1;
	static const int RIGHT_UNDERSCORE =0;
	static const int RIGHT_EXACT_EXPRESSION=1;
	static const int RIGHT_SUB_EXPRESSION =2;
	Pattern();
	~Pattern();;
	vector<vector<INTEGER>> evaluateWhileIfControlVariable(vector<INTEGER> list, string variable);
	vector<vector<INTEGER>> evaluateWhileIfControlVariableV2(vector<INTEGER> list, vector<int> listOfVariables, int leftFilterSwitch);
	vector<vector<INTEGER>> Pattern::evaluateAssign(vector<INTEGER> list, string leftFilterCondition, int leftFilterSwtich,	string expressionInfix, int rightFilterSwitch);
	vector<vector<INTEGER>> Pattern::evaluateAssignV2(vector<INTEGER> list, vector<int> listOfVariables, int leftFilterSwtich,	string expressionInfix, int rightFilterSwitch);
};

#endif